home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / html / parser / Entity.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.6 KB  |  58 lines

  1. package javax.swing.text.html.parser;
  2.  
  3. import java.util.Hashtable;
  4.  
  5. public final class Entity implements DTDConstants {
  6.    public String name;
  7.    public int type;
  8.    public char[] data;
  9.    static Hashtable entityTypes = new Hashtable();
  10.  
  11.    static {
  12.       entityTypes.put("PUBLIC", new Integer(10));
  13.       entityTypes.put("CDATA", new Integer(1));
  14.       entityTypes.put("SDATA", new Integer(11));
  15.       entityTypes.put("PI", new Integer(12));
  16.       entityTypes.put("STARTTAG", new Integer(13));
  17.       entityTypes.put("ENDTAG", new Integer(14));
  18.       entityTypes.put("MS", new Integer(15));
  19.       entityTypes.put("MD", new Integer(16));
  20.       entityTypes.put("SYSTEM", new Integer(17));
  21.    }
  22.  
  23.    public Entity(String var1, int var2, char[] var3) {
  24.       this.name = var1;
  25.       this.type = var2;
  26.       this.data = var3;
  27.    }
  28.  
  29.    public char[] getData() {
  30.       return this.data;
  31.    }
  32.  
  33.    public String getName() {
  34.       return this.name;
  35.    }
  36.  
  37.    public String getString() {
  38.       return new String(this.data, 0, this.data.length);
  39.    }
  40.  
  41.    public int getType() {
  42.       return this.type & '\uffff';
  43.    }
  44.  
  45.    public boolean isGeneral() {
  46.       return (this.type & 65536) != 0;
  47.    }
  48.  
  49.    public boolean isParameter() {
  50.       return (this.type & 262144) != 0;
  51.    }
  52.  
  53.    public static int name2type(String var0) {
  54.       Integer var1 = (Integer)entityTypes.get(var0);
  55.       return var1 == null ? 1 : var1;
  56.    }
  57. }
  58.